package com.learn.springboot.dao.request;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import lombok.Data;

/**
 * @author suzheng
 * @date 2024-05-17
 **/
@Data
public class CommonPageResult<PD> implements Serializable {

    private static final long serialVersionUID = -6790824298186846296L;
    /**
     * 接口返回信息 总记录数
     */
    private long totalCount=0;

    /**
     * 接口返回信息 总页数
     */
    private long totalPage=0;
    /**
     * 返回的数据集
     */
    private List<PD> data = new ArrayList<PD>();

    public String toString() {
        String dataTemp = null;
        if(getData() != null){
            if(getData().size() <= 20) {
                dataTemp = getData().toString();
            }else{
                dataTemp = "[...]";
            }
        }
        return "CommonPageResult(totalCount=" + getTotalCount() + ", data=" + dataTemp + ")";
    }
}